<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>文件管理</title>
    <link rel="stylesheet" type="text/css" href="/static/admin/plugins/webuploader/webuploader.css">
    <link rel="stylesheet" type="text/css" href="/static/admin/plugins/webuploader/css/style.css">
</head>
<body>
<div class="upload-box">
    <ul class="tabs">
        <li class="checked" id="upload_tab">本地上传</li>
        <li id="manage_tab">在线管理</li>
        <li id="search_tab">文件搜索</li>
    </ul>
    <div class="container">
        <div class="area upload-area area-checked" id="upload_area">
            <div id="uploader">
                <div class="statusBar" style="display:none;">
                    <div class="progress">
                        <span class="text">0%</span>
                        <span class="percentage"></span>
                    </div><div class="info"></div>
                    <div class="btns">
                        <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
                        <div class="saveBtn">确定使用</div>
                    </div>
                </div>
                <div class="queueList">
                    <div id="dndArea" class="placeholder">
                        <div id="filePicker"></div>
                        <p>或将文件拖到这里，本次最多可选1个</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="area manage-area" id="manage_area">
            <ul class="choose-btns">
                <li class="btn sure checked">确定</li>
                <li class="btn cancel">取消</li>
            </ul>
            <div class="file-list">
                <ul id="file_all_list">
                </ul>
            </div>
        </div>
        <div class="area search-area" id="search_area">
            <ul class="choose-btns">
                <li class="search">
                    <div class="search-condition">
                        <input class="key" type="text" />
                        <input class="submit" type="button" hidefocus="true" value="搜索" />
                    </div>
                </li>
                <li class="btn sure checked">确定</li>
                <li class="btn cancel">取消</li>
            </ul>
            <div class="file-list">
                <ul id="file_search_list">
                </ul>
            </div>
        </div>
        <div class="fileWarp" style="display:none;">
            <fieldset>
                <legend>列表</legend>
                <ul>
                </ul>
            </fieldset>
        </div>
    </div>
</div>
<script type="text/javascript"  src="/static/admin/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/static/admin/plugins/webuploader/webuploader.min.js"></script>
<script type="text/javascript" src="/static/admin/plugins/webuploader/upload.js?A=Q"></script>
<script>
    $(function(){
        moudle = 'Admin';
        var config = {
            "swf":"/static/admin/plugins/webuploader/Uploader.swf",
            "server":"{$info['upload']}",
            "filelistPah":"{$info['fileList']}",
            "delPath":"{url('admin/delupload')}",
            "chunked":false,
            "chunkSize":524288,
            "fileNumLimit":1,
            "fileSizeLimit":209715200,
            "fileSingleSizeLimit":2097152,
            "fileVal":"file",
            "auto":true,
            "formData":{'_token':'{{csrf_token()}}'},
            "pick":{"id":"#filePicker","label":"点击选择图片","name":"file"},
            "thumb":{"width":110,"height":110,"quality":70,"allowMagnify":true,"crop":true,"preserveHeaders":false,"type":"image\/jpeg"}
        };
        Manager.upload($.extend(config, {type : "Images"}));

        /*点击保存按钮时
         *判断允许上传数，检测是单一文件上传还是组文件上传
         *如果是单一文件，上传结束后将地址存入$input元素
         *如果是组文件上传，则创建input样式，添加到$input后面
         *隐藏父框架，清空列队，移除已上传文件样式*/
        $(".statusBar .saveBtn").click(function(){
            var callback = "{$info['func']}";
            if(callback != "undefined"){
                fileurl_tmp = $("input[name^='fileurl_tmp']").val();
                eval('window.parent.'+callback+'(fileurl_tmp)');
                window.parent.layer.closeAll();

            }
        });

    });
</script>
</body>
</html>